#region Copyright
/*
Copyright Notice: 
Use of this file, in source or binary form, is subject to the terms and conditions set forth 
in the included license.txt file.
*/
#endregion

/* This is a customised template.
 * It overrides some optional methods from EntityMap to allow for testing 
 * with Mocks and fast object creation. Search for #custom# below. 
 */


namespace WebbnessCMS.Security.Models
{

	#region Using statements

	using System;
	using System.Collections;
	using System.Collections.Generic;
	using System.Data;
	using Neo.Core;
	using Expergent;
	using Expergent.Neo;
	using Castle.Components.Validator;
		using Neo.Core.Util;
		using Neo.Framework;
			
	#endregion

	#region IPermission

	/// <summary>
	/// Generated table specific Interface </summary>
	/// <remarks> This Interface is generated by the Neo Framework. Make changes to NeoSupport.vtl.</remarks>
	public partial interface IPermission
	{
			
				/// <summary>
		/// Property PermissionID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.PermissionID.</remarks>
		/// <value> System.Guid. </value>
			System.Guid? PermissionID {get; set;}
	
					/// <summary>
		/// Property EntitySecurityKey - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitySecurityKey.</remarks>
		/// <value> System.Guid. </value>
			System.Guid? EntitySecurityKey {get; set;}
	
					/// <summary>
		/// Property Allow - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Allow.</remarks>
		/// <value> System.Boolean. </value>
			System.Boolean? Allow {get; set;}
	
					/// <summary>
		/// Property Level - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Level.</remarks>
		/// <value> System.Int32. </value>
			System.Int32? Level {get; set;}
	
					/// <summary>
		/// Property EntityTypeName - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeName.</remarks>
		/// <value> System.String. </value>
			System.String EntityTypeName {get; set;}
	
					/// <summary>
		/// Property EntityTypeID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeID.</remarks>
		/// <value> System.Guid. </value>
			System.Guid? EntityTypeID {get; set;}
	
					/// <summary>
		/// Property OperationID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.OperationID.</remarks>
		/// <value> System.Guid. </value>
			System.Guid? OperationID {get; set;}
	
					/// <summary>
		/// Property UserID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UserID.</remarks>
		/// <value> System.Guid. </value>
			System.Guid? UserID {get; set;}
	
					/// <summary>
		/// Property UsersGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UsersGroupID.</remarks>
		/// <value> System.Guid. </value>
			System.Guid? UsersGroupID {get; set;}
	
					/// <summary>
		/// Property EntitiesGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitiesGroupID.</remarks>
		/// <value> System.Guid. </value>
			System.Guid? EntitiesGroupID {get; set;}
	
		
			/// <summary>
		/// Property Operation - gets or sets the Operation object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property Operation - gets or sets the Operation object with a one-to-one relationship to this instance.</remarks>
		/// <value> Operation. </value>
		Operation Operation {get; set;}

			/// <summary>
		/// Property EntityType - gets or sets the EntityType object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property EntityType - gets or sets the EntityType object with a one-to-one relationship to this instance.</remarks>
		/// <value> EntityType. </value>
		EntityType EntityType {get; set;}

			/// <summary>
		/// Property EntitiesGroup - gets or sets the EntitiesGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property EntitiesGroup - gets or sets the EntitiesGroup object with a one-to-one relationship to this instance.</remarks>
		/// <value> EntitiesGroup. </value>
		EntitiesGroup EntitiesGroup {get; set;}

			/// <summary>
		/// Property UsersGroup - gets or sets the UsersGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property UsersGroup - gets or sets the UsersGroup object with a one-to-one relationship to this instance.</remarks>
		/// <value> UsersGroup. </value>
		UsersGroup UsersGroup {get; set;}

			/// <summary>
		/// Property User - gets or sets the AuthenticatedUser object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property User - gets or sets the AuthenticatedUser object with a one-to-one relationship to this instance.</remarks>
		/// <value> AuthenticatedUser. </value>
		AuthenticatedUser User {get; set;}

		}

	#endregion

	#region Permission

	/// <summary>
	/// Generated table specific Base Class </summary>
	/// <remarks> This class is generated by the Neo Framework. Make changes to NeoSupport.vtl.</remarks>
	[Serializable]
	public partial class Permission : RulesEnabledEntityObject, IPermission
	{
	
			internal Permission(System.Data.DataRow aRow, Neo.Core.ObjectContext aContext) : base(aRow, aContext)
		{
				}
		
				/// <summary>
		/// Property PermissionID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.PermissionID.</remarks>
		/// <value> System.Guid. </value>
				public virtual System.Guid? PermissionID
		{
			get { object v = Row["PermissionID"]; return (System.Guid?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["PermissionID"] = value; else Row["PermissionID"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property EntitySecurityKey - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitySecurityKey.</remarks>
		/// <value> System.Guid. </value>
				public virtual System.Guid? EntitySecurityKey
		{
			get { object v = Row["EntitySecurityKey"]; return (System.Guid?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["EntitySecurityKey"] = value; else Row["EntitySecurityKey"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property Allow - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Allow.</remarks>
		/// <value> System.Boolean. </value>
				public virtual System.Boolean? Allow
		{
			get { object v = Row["Allow"]; return (System.Boolean?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["Allow"] = value; else Row["Allow"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property Level - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Level.</remarks>
		/// <value> System.Int32. </value>
				public virtual System.Int32? Level
		{
			get { object v = Row["Level"]; return (System.Int32?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["Level"] = value; else Row["Level"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property EntityTypeName - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeName.</remarks>
		/// <value> System.String. </value>
				public virtual System.String EntityTypeName
		{
			get { return Row["EntityTypeName"] as System.String; }
				set { Row["EntityTypeName"] = (value != null) ? (object)value : (object)DBNull.Value; }
				}    

					/// <summary>
		/// Property EntityTypeID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeID.</remarks>
		/// <value> System.Guid. </value>
				public virtual System.Guid? EntityTypeID
		{
			get { object v = Row["EntityTypeID"]; return (System.Guid?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["EntityTypeID"] = value; else Row["EntityTypeID"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property OperationID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.OperationID.</remarks>
		/// <value> System.Guid. </value>
				public virtual System.Guid? OperationID
		{
			get { object v = Row["OperationID"]; return (System.Guid?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["OperationID"] = value; else Row["OperationID"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property UserID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UserID.</remarks>
		/// <value> System.Guid. </value>
				public virtual System.Guid? UserID
		{
			get { object v = Row["UserID"]; return (System.Guid?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["UserID"] = value; else Row["UserID"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property UsersGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UsersGroupID.</remarks>
		/// <value> System.Guid. </value>
				public virtual System.Guid? UsersGroupID
		{
			get { object v = Row["UsersGroupID"]; return (System.Guid?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["UsersGroupID"] = value; else Row["UsersGroupID"] = DBNull.Value; }
				}    

					/// <summary>
		/// Property EntitiesGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitiesGroupID.</remarks>
		/// <value> System.Guid. </value>
				public virtual System.Guid? EntitiesGroupID
		{
			get { object v = Row["EntitiesGroupID"]; return (System.Guid?)((v != DBNull.Value) ? v : null); }
				set { if (value.HasValue) Row["EntitiesGroupID"] = value; else Row["EntitiesGroupID"] = DBNull.Value; }
				}    

		
			/// <summary>
		/// Property Operation - gets or sets the Operation object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property Operation - gets or sets the Operation object with a one-to-one relationship to this instance.</remarks>
		/// <value> Operation. </value>
		public virtual Operation Operation
		{
			get { object fk = Row["OperationID"]; return (fk == DBNull.Value) ? null : (Operation)GetRelatedObject("Security_Operations", fk); }
			set { SetRelatedObject(value, "OperationID", "OperationID" ); }
		}

			/// <summary>
		/// Property EntityType - gets or sets the EntityType object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property EntityType - gets or sets the EntityType object with a one-to-one relationship to this instance.</remarks>
		/// <value> EntityType. </value>
		public virtual EntityType EntityType
		{
			get { object fk = Row["EntityTypeID"]; return (fk == DBNull.Value) ? null : (EntityType)GetRelatedObject("Security_EntityTypes", fk); }
			set { SetRelatedObject(value, "EntityTypeID", "EntityTypeID" ); }
		}

			/// <summary>
		/// Property EntitiesGroup - gets or sets the EntitiesGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property EntitiesGroup - gets or sets the EntitiesGroup object with a one-to-one relationship to this instance.</remarks>
		/// <value> EntitiesGroup. </value>
		public virtual EntitiesGroup EntitiesGroup
		{
			get { object fk = Row["EntitiesGroupID"]; return (fk == DBNull.Value) ? null : (EntitiesGroup)GetRelatedObject("Security_EntitiesGroups", fk); }
			set { SetRelatedObject(value, "EntitiesGroupID", "EntitiesGroupID" ); }
		}

			/// <summary>
		/// Property UsersGroup - gets or sets the UsersGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property UsersGroup - gets or sets the UsersGroup object with a one-to-one relationship to this instance.</remarks>
		/// <value> UsersGroup. </value>
		public virtual UsersGroup UsersGroup
		{
			get { object fk = Row["UsersGroupID"]; return (fk == DBNull.Value) ? null : (UsersGroup)GetRelatedObject("Security_UsersGroups", fk); }
			set { SetRelatedObject(value, "UsersGroupID", "UsersGroupID" ); }
		}

			/// <summary>
		/// Property User - gets or sets the AuthenticatedUser object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property User - gets or sets the AuthenticatedUser object with a one-to-one relationship to this instance.</remarks>
		/// <value> AuthenticatedUser. </value>
		public virtual AuthenticatedUser User
		{
			get { object fk = Row["UserID"]; return (fk == DBNull.Value) ? null : (AuthenticatedUser)GetRelatedObject("Security_Users", fk); }
			set { SetRelatedObject(value, "UserID", "UserID" ); }
		}

				/// <summary>
		/// Returns the value associated with the propName parameter.</summary>
		/// <remarks> You will need to cast the returned object into its native type upon return.</remarks>
		/// <param name="propName">String property name.</param>
		/// <returns> System.Object. </returns>
		public override object GetProperty(string propName)
		{
					if(propName == "PermissionID") 
				return PermissionID;
						if(propName == "EntitySecurityKey") 
				return EntitySecurityKey;
						if(propName == "Allow") 
				return Allow;
						if(propName == "Level") 
				return Level;
						if(propName == "EntityTypeName") 
				return EntityTypeName;
						if(propName == "EntityTypeID") 
				return EntityTypeID;
						if(propName == "OperationID") 
				return OperationID;
						if(propName == "UserID") 
				return UserID;
						if(propName == "UsersGroupID") 
				return UsersGroupID;
						if(propName == "EntitiesGroupID") 
				return EntitiesGroupID;
						if(propName == "Operation") 
				return Operation;
				if(propName == "EntityType") 
				return EntityType;
				if(propName == "EntitiesGroup") 
				return EntitiesGroup;
				if(propName == "UsersGroup") 
				return UsersGroup;
				if(propName == "User") 
				return User;
					return ExtendGetProperty(propName);
		}
		
		/// <summary>
		/// Sets the value associated with the propName parameter to the value specified.
		/// </summary>
		/// <param name="propName">String property name.</param>
		/// <param name="value">The value.</param>
		public override void SetProperty(string propName, object value)
		{
						if(propName == "PermissionID") 
			{
				PermissionID = (System.Guid?)value;
				return;
			}
								if(propName == "EntitySecurityKey") 
			{
				EntitySecurityKey = (System.Guid?)value;
				return;
			}
								if(propName == "Allow") 
			{
				Allow = (System.Boolean?)value;
				return;
			}
								if(propName == "Level") 
			{
				Level = (System.Int32?)value;
				return;
			}
								if(propName == "EntityTypeName") 
			{
				EntityTypeName = (System.String)value;
				return;
			}
								if(propName == "EntityTypeID") 
			{
				EntityTypeID = (System.Guid?)value;
				return;
			}
								if(propName == "OperationID") 
			{
				OperationID = (System.Guid?)value;
				return;
			}
								if(propName == "UserID") 
			{
				UserID = (System.Guid?)value;
				return;
			}
								if(propName == "UsersGroupID") 
			{
				UsersGroupID = (System.Guid?)value;
				return;
			}
								if(propName == "EntitiesGroupID") 
			{
				EntitiesGroupID = (System.Guid?)value;
				return;
			}
							if(propName == "Operation") 
			{
				Operation = (Operation)value;
				return;
			}
				if(propName == "EntityType") 
			{
				EntityType = (EntityType)value;
				return;
			}
				if(propName == "EntitiesGroup") 
			{
				EntitiesGroup = (EntitiesGroup)value;
				return;
			}
				if(propName == "UsersGroup") 
			{
				UsersGroup = (UsersGroup)value;
				return;
			}
				if(propName == "User") 
			{
				User = (AuthenticatedUser)value;
				return;
			}
				ExtendSetProperty(propName, value);
		}
		
		/// <summary>
		/// Adds a set of facts for this instance to the list.
		/// </summary>
		/// <param name="list">The list.</param>
		/// <param name="parent">The parent.</param>
		protected override void MakeFacts(List<WME> list, string parent)
		{
					list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "PermissionID"), PermissionID));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "EntitySecurityKey"), EntitySecurityKey));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "Allow"), Allow));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "Level"), Level));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "EntityTypeName"), EntityTypeName));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "EntityTypeID"), EntityTypeID));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "OperationID"), OperationID));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "UserID"), UserID));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "UsersGroupID"), UsersGroupID));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "EntitiesGroupID"), EntitiesGroupID));
						list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "Operation"), Operation));
				list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "EntityType"), EntityType));
				list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "EntitiesGroup"), EntitiesGroup));
				list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "UsersGroup"), UsersGroup));
				list.Add(new WME(new EntityObjectTerm(this), MakePredicate(parent, "User"), User));
					ExtendMakeFacts(list, parent);
			myFactsHaveBeenAsserted = true;
		}

		/// <summary>
		/// Gets the default sort order.
		/// </summary>
		/// <value>The sort order.</value>
		public static PropertyComparer DefaultSortOrder
		{
			get
			{
					return new PropertyComparer("PermissionID", SortDirection.Ascending);
				}    
		}

			
		/// <summary>
		/// Populates the EntityObject from the specified surrogate.
		/// </summary>
		/// <param name="surrogate">The surrogate.</param>
		public void Populate(PermissionSurrogate surrogate)
		{
							EntitySecurityKey = surrogate.EntitySecurityKey;
						Allow = surrogate.Allow;
						Level = surrogate.Level;
						EntityTypeName = surrogate.EntityTypeName;
						EntityTypeID = surrogate.EntityTypeID;
						OperationID = surrogate.OperationID;
						UserID = surrogate.UserID;
						UsersGroupID = surrogate.UsersGroupID;
						EntitiesGroupID = surrogate.EntitiesGroupID;
				}
	}

	#endregion

	#region PermissionTemplate

	/// <summary>
	/// Generated table specific Query Template Class </summary>
	/// <remarks> A Query Template for Permission operations. </remarks>
	public class PermissionTemplate : QueryTemplate
	{

		/// <summary>
		/// Constructor </summary>
		/// <remarks> Public Constructor.</remarks>
		/// <param name="anEntityMap">IEntityMap instance.</param>
		public PermissionTemplate(IEntityMap anEntityMap) : base(anEntityMap)
		{
		}
		
				/// <summary>
		/// Property PermissionID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.PermissionID.</remarks>
		/// <value> System.Guid. </value>
		public System.Guid PermissionID
		{
			get { return (System.Guid)QueryValues["PermissionID"]; }
			set { QueryValues["PermissionID"] = value; }
		}

					/// <summary>
		/// Property EntitySecurityKey - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitySecurityKey.</remarks>
		/// <value> System.Guid. </value>
		public System.Guid EntitySecurityKey
		{
			get { return (System.Guid)QueryValues["EntitySecurityKey"]; }
			set { QueryValues["EntitySecurityKey"] = value; }
		}

					/// <summary>
		/// Property Allow - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Allow.</remarks>
		/// <value> System.Boolean. </value>
		public System.Boolean Allow
		{
			get { return (System.Boolean)QueryValues["Allow"]; }
			set { QueryValues["Allow"] = value; }
		}

					/// <summary>
		/// Property Level - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Level.</remarks>
		/// <value> System.Int32. </value>
		public System.Int32 Level
		{
			get { return (System.Int32)QueryValues["Level"]; }
			set { QueryValues["Level"] = value; }
		}

					/// <summary>
		/// Property EntityTypeName - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeName.</remarks>
		/// <value> System.String. </value>
		public System.String EntityTypeName
		{
			get { return (System.String)QueryValues["EntityTypeName"]; }
			set { QueryValues["EntityTypeName"] = value; }
		}

					/// <summary>
		/// Property EntityTypeID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeID.</remarks>
		/// <value> System.Guid. </value>
		public System.Guid EntityTypeID
		{
			get { return (System.Guid)QueryValues["EntityTypeID"]; }
			set { QueryValues["EntityTypeID"] = value; }
		}

					/// <summary>
		/// Property OperationID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.OperationID.</remarks>
		/// <value> System.Guid. </value>
		public System.Guid OperationID
		{
			get { return (System.Guid)QueryValues["OperationID"]; }
			set { QueryValues["OperationID"] = value; }
		}

					/// <summary>
		/// Property UserID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UserID.</remarks>
		/// <value> System.Guid. </value>
		public System.Guid UserID
		{
			get { return (System.Guid)QueryValues["UserID"]; }
			set { QueryValues["UserID"] = value; }
		}

					/// <summary>
		/// Property UsersGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UsersGroupID.</remarks>
		/// <value> System.Guid. </value>
		public System.Guid UsersGroupID
		{
			get { return (System.Guid)QueryValues["UsersGroupID"]; }
			set { QueryValues["UsersGroupID"] = value; }
		}

					/// <summary>
		/// Property EntitiesGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitiesGroupID.</remarks>
		/// <value> System.Guid. </value>
		public System.Guid EntitiesGroupID
		{
			get { return (System.Guid)QueryValues["EntitiesGroupID"]; }
			set { QueryValues["EntitiesGroupID"] = value; }
		}

					/// <summary>
		/// Property Operation - gets or sets the Operation object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Gets or sets the Operation object.</remarks>
		/// <value> Operation. </value>
		public Operation Operation
		{
			get { return (Operation)QueryValues["Operation"]; }
			set { QueryValues["Operation"] = value; }
		}

			/// <summary>
		/// Property EntityType - gets or sets the EntityType object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Gets or sets the EntityType object.</remarks>
		/// <value> EntityType. </value>
		public EntityType EntityType
		{
			get { return (EntityType)QueryValues["EntityType"]; }
			set { QueryValues["EntityType"] = value; }
		}

			/// <summary>
		/// Property EntitiesGroup - gets or sets the EntitiesGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Gets or sets the EntitiesGroup object.</remarks>
		/// <value> EntitiesGroup. </value>
		public EntitiesGroup EntitiesGroup
		{
			get { return (EntitiesGroup)QueryValues["EntitiesGroup"]; }
			set { QueryValues["EntitiesGroup"] = value; }
		}

			/// <summary>
		/// Property UsersGroup - gets or sets the UsersGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Gets or sets the UsersGroup object.</remarks>
		/// <value> UsersGroup. </value>
		public UsersGroup UsersGroup
		{
			get { return (UsersGroup)QueryValues["UsersGroup"]; }
			set { QueryValues["UsersGroup"] = value; }
		}

			/// <summary>
		/// Property User - gets or sets the AuthenticatedUser object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Gets or sets the AuthenticatedUser object.</remarks>
		/// <value> AuthenticatedUser. </value>
		public AuthenticatedUser User
		{
			get { return (AuthenticatedUser)QueryValues["User"]; }
			set { QueryValues["User"] = value; }
		}

		               
	}

	#endregion

	#region PermissionFactory

	/// <summary>
	/// Factory class for the creation of Permission objects.</summary>
	public class PermissionFactory : Neo.Framework.GenericObjectFactory<Permission>
	{

		/// <summary>
		/// Constructor requiring an ObjectContext parameter.</summary>
		/// <remarks> Main entry point for the retrieval and creation of new Permission objects.</remarks>
		/// <param name="context">ObjectContext.</param>
		public PermissionFactory(ObjectContext context) : base(context, typeof(Permission))
		{
		}

			/// <summary>
		/// Create new Permission object.</summary>
		/// <remarks>IdMethod = Guid, PrimaryKeyIsForeignKey = False, RelationshipSetsForColumns = 0.</remarks>
		/// <returns> Permission </returns>
		public Permission CreateObject()
		{
			return (Permission)base.CreateObject(null);
		}
		
	
		/// <summary>
		/// Find a specified Permission object.</summary>
		/// <remarks> Requires Primary Key values and/or parent object instances.</remarks>
			/// <param name="arg0">.</param>
			/// <returns> Permission </returns>
		public Permission FindObject(System.Guid arg0)
		{
			return (Permission)base.FindObject(new object[] { arg0 } );
		}

		///<summary>
		///Find a specified Permission object.</summary>
		///<remarks> Requires Primary Key values and/or parent object instances.</remarks>
			///<param name="arg0">.</param>
			///<returns> Permission </returns>
		public Permission FindObjectByPK( System.Guid arg0 )
		{
			return (Permission) base.FindObject( new object[] {  arg0 } );
		}
		
					
			///<summary>
		///Find a specified Permission object.</summary>
		///<remarks> Requires Primary Key values and/or parent object instances.</remarks>
			///<param name="arg0">.</param>
			///<returns> Permission </returns>
		public Permission FindObjectByPK( System.Guid? arg0 )
		{
			return (Permission) base.FindObject( new object[] {  arg0.Value } );
		}
			
		/// <summary>
		/// Return the correct Query Template for the Permission object.</summary>
		/// <remarks> A query template is used for creating SQL like queries, in a more OO fashion.</remarks>
		/// <returns> PermissionTemplate </returns>
		public PermissionTemplate GetQueryTemplate()
		{
			return new PermissionTemplate(EntityMap);
		}
		
		/// <summary>
		/// SQL like query to find and return an object.</summary>
		/// <remarks> For example: ...FindFirst("TitleAuthors.(Title = {0} or Title.Publisher = {1})", title, publisher).</remarks>
		/// <param name="qualifierFormat">String.</param>
		/// <param name="parameters">params object[].</param>
		/// <returns> Permission. </returns>
		public override Permission FindFirst(string qualifierFormat, params object[] parameters)
		{
			ObjectList<Permission> results = FindWithLimit(1, qualifierFormat, parameters);
			return (results.Count > 0) ? results[0] : null;
		}

		/// <summary>
		/// SQL like query to find and return an object.</summary>
		/// <remarks> For example: ...FindFirst("TitleAuthors.(Title = {0} or Title.Publisher = {1})", title, publisher).</remarks>
		/// <param name="q">The Qualifier.</param>
		/// <returns>Permission</returns>
		public override Permission FindFirst(Qualifier q)
		{
			FetchSpecification f = new FetchSpecification(EntityMap, q, 1);
			ObjectList<Permission> result = Find(f);
			return result.Count > 0 ? result[0]: null;
		}
	}

	#endregion

	#region PermissionEntityMap

	//  -------- Entity Map -----------------------------------------------------
	/// <summary>Creates the in memory version of the dataset for the Permission DOM.</summary>
	/// <remarks>Generated by Neo Framework.</remarks>
	internal class PermissionMap : EntityMap
	{
		  /// <summary>Array of Primary Key column names.</summary>
		  /// <remarks>Primary Key columns.</remarks>
		private static readonly string[] pkcolumns = { "PermissionID" };
		/// <summary>Array of Database column names.</summary>
		  /// <remarks>Database column names.</remarks>
		private static readonly string[] columns = { "PermissionID", "EntitySecurityKey", "Allow", "Level", "EntityTypeName", "EntityTypeID", "OperationID", "UserID", "UsersGroupID", "EntitiesGroupID" };
		/// <summary>Array of DOM object properties.</summary>
		  /// <remarks>DOM object properties.</remarks>
		private static readonly string[] attributes = { "PermissionID", "EntitySecurityKey", "Allow", "Level", "EntityTypeName", "EntityTypeID", "OperationID", "UserID", "UsersGroupID", "EntitiesGroupID" };
		/// <summary>Array of Related Object names.</summary>
		  /// <remarks>Related Object names.</remarks>
		private static readonly string[] relations = { "Operation", "EntityType", "EntitiesGroup", "UsersGroup", "User" };

		private Type concreteObjectType = typeof(Permission);

		  /// <summary>Property ObjectType.</summary>
		  /// <remarks>Returns the DOM's Type.</remarks>
		  /// <value>System.Type.</value>
		public override System.Type ObjectType
		{
			get { return typeof(Permission); }
		}
	    
		/// <summary>Property ObjectType.</summary>
		  /// <remarks>Returns the DOM's Type.</remarks>
		  /// <value>System.Type.</value>
		public override System.Type ConcreteObjectType
		{
			get { return concreteObjectType; }										 /* #custom# overridden */
			set { concreteObjectType = value; Factory.AddCustomType(value, this); }  /* #custom# overridden */
		}
	    
		/// <summary>Property TableName.</summary>
		  /// <remarks>Returns database table name.</remarks>
		  /// <value>string.</value>
		public override string TableName
		{
			get { return "Security_Permissions"; }
		}
	    
		/// <summary>Property PrimaryKeyColumns.</summary>
		/// <remarks>Array of Primary Key column names.</remarks>
		/// <value>string[].</value>
		public override string[] PrimaryKeyColumns
		{
			get { return pkcolumns; }
		}

		/// <summary>Property Columns.</summary>
		/// <remarks>Array of Database column names.</remarks>
		/// <value>string[].</value>
		public override string[] Columns
		{
			get { return columns; }
		}

		/// <summary>Property Attributes.</summary>
		/// <remarks>Array of DOM object properties.</remarks>
		/// <value>string[].</value>
		public override string[] Attributes
		{
			get { return attributes; }
		}

		/// <summary>Property Relations.</summary>
		/// <remarks>Array of Related Object names.</remarks>
		/// <value>string[].</value>
		public override string[] Relations
		{
			get { return relations; }
		}

		/// <summary>Generates a Hashtable, keyed by Object Name, or information regarding related objects.</summary>
		/// <remarks>Related Objects.</remarks>
		/// <returns>IDictionary.</returns>
  		protected override IDictionary GetRelationInfos()
		{
    		IDictionary infos = new Hashtable(5);
	 	 			infos.Add("Operation", new RelationInfo(Factory, typeof(Operation), typeof(Permission), "OperationID", "OperationID"));
			 			infos.Add("EntityType", new RelationInfo(Factory, typeof(EntityType), typeof(Permission), "EntityTypeID", "EntityTypeID"));
			 			infos.Add("EntitiesGroup", new RelationInfo(Factory, typeof(EntitiesGroup), typeof(Permission), "EntitiesGroupID", "EntitiesGroupID"));
			 			infos.Add("UsersGroup", new RelationInfo(Factory, typeof(UsersGroup), typeof(Permission), "UsersGroupID", "UsersGroupID"));
			 			infos.Add("User", new RelationInfo(Factory, typeof(AuthenticatedUser), typeof(Permission), "UserID", "UserID"));
					return infos;    	
		}
	    
		/// <summary>Based upon the model specified Id Method, returns the proper PkInitializer.</summary>
		/// <remarks>The object used to create a new PK value.</remarks>
		/// <returns>IPkInitializer.</returns>
		public override IPkInitializer GetPkInitializer()
		{
				return new GuidPkInitializer();
			}
	    
		/// <summary>Creates a new instance of Permission.</summary>
		/// <remarks>Create new Permission.</remarks>
		/// <param name="row">DataRow.</param>
		/// <param name="context">ObjectContext.</param>
		/// <returns>IEntityObject.</returns>
		public override IEntityObject CreateInstance(DataRow row, ObjectContext context) /* #custom# overridden */
		{
			if(ConcreteObjectType != ObjectType)
				return base.CreateInstance(row, context);
			return new Permission(row, context);
		}
	    
		/// <summary>Generates the in memory dataset.</summary>
		/// <remarks>Called by the Factory object.</remarks>
		/// <param name="table">DataTable.</param>
		protected override void WriteBasicSchema(DataTable table)
		{
			DataColumn		c;
			
				c = table.Columns.Add("PermissionID", typeof(System.Guid));
					c.Unique = true;
										c = table.Columns.Add("EntitySecurityKey", typeof(System.Guid));
					c.AllowDBNull = true;
							c = table.Columns.Add("Allow", typeof(System.Boolean));
							c.DefaultValue = Convert.ChangeType("true", typeof(System.Boolean));
							c = table.Columns.Add("Level", typeof(System.Int32));
								c = table.Columns.Add("EntityTypeName", typeof(System.String));
					c.AllowDBNull = true;
							c = table.Columns.Add("EntityTypeID", typeof(System.Guid));
					c.AllowDBNull = true;
							c = table.Columns.Add("OperationID", typeof(System.Guid));
								c = table.Columns.Add("UserID", typeof(System.Guid));
					c.AllowDBNull = true;
							c = table.Columns.Add("UsersGroupID", typeof(System.Guid));
					c.AllowDBNull = true;
							c = table.Columns.Add("EntitiesGroupID", typeof(System.Guid));
					c.AllowDBNull = true;
							table.PrimaryKey = new DataColumn[] { table.Columns["PermissionID"] };
		}
		
			/// <summary>Generates the dataset relationships.</summary>
		/// <remarks>Dataset Relationships.</remarks>
		/// <param name="table">DataTable.</param>
		protected override void WriteRelations(DataTable table)
		{
			DataRelation r;
			
					if(table.DataSet.Relations["Security_Operations*Security_Permissions.OperationID"] == null)
			{
				r = table.DataSet.Relations.Add("Security_Operations*Security_Permissions.OperationID", 
						table.DataSet.Tables["Security_Operations"].Columns["OperationID"],
						table.DataSet.Tables["Security_Permissions"].Columns["OperationID"]);
						r.ChildKeyConstraint.UpdateRule = Rule.None;
				r.ChildKeyConstraint.DeleteRule = Rule.Cascade;
				}
						if(table.DataSet.Relations["Security_EntityTypes*Security_Permissions.EntityTypeID"] == null)
			{
				r = table.DataSet.Relations.Add("Security_EntityTypes*Security_Permissions.EntityTypeID", 
						table.DataSet.Tables["Security_EntityTypes"].Columns["EntityTypeID"],
						table.DataSet.Tables["Security_Permissions"].Columns["EntityTypeID"]);
						r.ChildKeyConstraint.UpdateRule = Rule.None;
				r.ChildKeyConstraint.DeleteRule = Rule.None;
				}
						if(table.DataSet.Relations["Security_EntitiesGroups*Security_Permissions.EntitiesGroupID"] == null)
			{
				r = table.DataSet.Relations.Add("Security_EntitiesGroups*Security_Permissions.EntitiesGroupID", 
						table.DataSet.Tables["Security_EntitiesGroups"].Columns["EntitiesGroupID"],
						table.DataSet.Tables["Security_Permissions"].Columns["EntitiesGroupID"]);
						r.ChildKeyConstraint.UpdateRule = Rule.None;
				r.ChildKeyConstraint.DeleteRule = Rule.None;
				}
						if(table.DataSet.Relations["Security_UsersGroups*Security_Permissions.UsersGroupID"] == null)
			{
				r = table.DataSet.Relations.Add("Security_UsersGroups*Security_Permissions.UsersGroupID", 
						table.DataSet.Tables["Security_UsersGroups"].Columns["UsersGroupID"],
						table.DataSet.Tables["Security_Permissions"].Columns["UsersGroupID"]);
						r.ChildKeyConstraint.UpdateRule = Rule.None;
				r.ChildKeyConstraint.DeleteRule = Rule.None;
				}
						if(table.DataSet.Relations["Security_Users*Security_Permissions.UserID"] == null)
			{
				r = table.DataSet.Relations.Add("Security_Users*Security_Permissions.UserID", 
						table.DataSet.Tables["Security_Users"].Columns["UserID"],
						table.DataSet.Tables["Security_Permissions"].Columns["UserID"]);
						r.ChildKeyConstraint.UpdateRule = Rule.None;
				r.ChildKeyConstraint.DeleteRule = Rule.None;
				}
				}
		}

	#endregion

	#region PermissionSurrogate

	/// <summary>Represents an entity object disconnected from the database.</summary>
	/// <remarks>
	///   <para>Database Path: WebbnessCMS.Security_Permissions.</para>
	/// </remarks>
	public partial class PermissionSurrogate : EntityObjectSurrogate, IPermission
	{
		/// <summary>Default constructor.</summary>
		public PermissionSurrogate()
		{
										_allow = (System.Boolean)System.Convert.ChangeType("true", typeof(System.Boolean));
																				}
	    
	    
	    
		/// <summary>
		/// Initializes a new instance of the <see cref="PermissionSurrogate"/> class.
		/// </summary>
		/// <param name="entity">The entity.</param>
		public PermissionSurrogate(Permission entity)
		{
					PermissionID = entity.PermissionID;
						EntitySecurityKey = entity.EntitySecurityKey;
						Allow = entity.Allow;
						Level = entity.Level;
						EntityTypeName = entity.EntityTypeName;
						EntityTypeID = entity.EntityTypeID;
						OperationID = entity.OperationID;
						UserID = entity.UserID;
						UsersGroupID = entity.UsersGroupID;
						EntitiesGroupID = entity.EntitiesGroupID;
				}

	
		/// <summary>
		/// Property Operation - gets or sets the Operation object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property Operation - gets or sets the Operation object with a one-to-one relationship to this instance.</remarks>
		/// <value> Operation. </value>
		public virtual Operation Operation
		{
			get { return _Operation; }
			set { _Operation = value; }
		}
		
		private Operation _Operation;
		/// <summary>
		/// Property EntityType - gets or sets the EntityType object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property EntityType - gets or sets the EntityType object with a one-to-one relationship to this instance.</remarks>
		/// <value> EntityType. </value>
		public virtual EntityType EntityType
		{
			get { return _EntityType; }
			set { _EntityType = value; }
		}
		
		private EntityType _EntityType;
		/// <summary>
		/// Property EntitiesGroup - gets or sets the EntitiesGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property EntitiesGroup - gets or sets the EntitiesGroup object with a one-to-one relationship to this instance.</remarks>
		/// <value> EntitiesGroup. </value>
		public virtual EntitiesGroup EntitiesGroup
		{
			get { return _EntitiesGroup; }
			set { _EntitiesGroup = value; }
		}
		
		private EntitiesGroup _EntitiesGroup;
		/// <summary>
		/// Property UsersGroup - gets or sets the UsersGroup object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property UsersGroup - gets or sets the UsersGroup object with a one-to-one relationship to this instance.</remarks>
		/// <value> UsersGroup. </value>
		public virtual UsersGroup UsersGroup
		{
			get { return _UsersGroup; }
			set { _UsersGroup = value; }
		}
		
		private UsersGroup _UsersGroup;
		/// <summary>
		/// Property User - gets or sets the AuthenticatedUser object with a one-to-one relationship to this instance.</summary>
		/// <remarks> Property User - gets or sets the AuthenticatedUser object with a one-to-one relationship to this instance.</remarks>
		/// <value> AuthenticatedUser. </value>
		public virtual AuthenticatedUser User
		{
			get { return _User; }
			set { _User = value; }
		}
		
		private AuthenticatedUser _User;
	
		/// <summary>
		/// Updates the entity with the values contained within the surrogate.
		/// </summary>
		/// <param name="entity">The entity.</param>
		public void BindObjectInstance(Permission entity)
		{
							entity.EntitySecurityKey = EntitySecurityKey;
						entity.Allow = Allow;
						entity.Level = Level;
						entity.EntityTypeName = EntityTypeName;
						entity.EntityTypeID = EntityTypeID;
						entity.OperationID = OperationID;
						entity.UserID = UserID;
						entity.UsersGroupID = UsersGroupID;
						entity.EntitiesGroupID = EntitiesGroupID;
				}

					/// <summary>
		/// Property PermissionID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.PermissionID.</remarks>
		/// <value> System.Guid. </value>
			public System.Guid? PermissionID
		{
    		get {return _permissionid;}
				set {_permissionid = value;}
			}

		private System.Guid? _permissionid;
		
							/// <summary>
		/// Property EntitySecurityKey - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitySecurityKey.</remarks>
		/// <value> System.Guid. </value>
			public System.Guid? EntitySecurityKey
		{
    		get {return _entitysecuritykey;}
	    		set {_entitysecuritykey = value;}
			}

		private System.Guid? _entitysecuritykey;
		
							/// <summary>
		/// Property Allow - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Allow.</remarks>
		/// <value> System.Boolean. </value>
			public System.Boolean? Allow
		{
    		get {return _allow;}
	    		set {_allow = value;}
			}

		private System.Boolean? _allow;
		
							/// <summary>
		/// Property Level - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.Level.</remarks>
		/// <value> System.Int32. </value>
			public System.Int32? Level
		{
    		get {return _level;}
	    		set {_level = value;}
			}

		private System.Int32? _level;
		
							/// <summary>
		/// Property EntityTypeName - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeName.</remarks>
		/// <value> System.String. </value>
			public System.String EntityTypeName
		{
    		get {return _entitytypename;}
	    		set {_entitytypename = value;}
			}

		private System.String _entitytypename;
		
							/// <summary>
		/// Property EntityTypeID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntityTypeID.</remarks>
		/// <value> System.Guid. </value>
			public System.Guid? EntityTypeID
		{
    		get {return _entitytypeid;}
	    		set {_entitytypeid = value;}
			}

		private System.Guid? _entitytypeid;
		
							/// <summary>
		/// Property OperationID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.OperationID.</remarks>
		/// <value> System.Guid. </value>
			public System.Guid? OperationID
		{
    		get {return _operationid;}
	    		set {_operationid = value;}
			}

		private System.Guid? _operationid;
		
							/// <summary>
		/// Property UserID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UserID.</remarks>
		/// <value> System.Guid. </value>
			public System.Guid? UserID
		{
    		get {return _userid;}
	    		set {_userid = value;}
			}

		private System.Guid? _userid;
		
							/// <summary>
		/// Property UsersGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.UsersGroupID.</remarks>
		/// <value> System.Guid. </value>
			public System.Guid? UsersGroupID
		{
    		get {return _usersgroupid;}
	    		set {_usersgroupid = value;}
			}

		private System.Guid? _usersgroupid;
		
							/// <summary>
		/// Property EntitiesGroupID - No Description </summary>
		/// <remarks> Database Path: WebbnessCMS.Security_Permissions.EntitiesGroupID.</remarks>
		/// <value> System.Guid. </value>
			public System.Guid? EntitiesGroupID
		{
    		get {return _entitiesgroupid;}
	    		set {_entitiesgroupid = value;}
			}

		private System.Guid? _entitiesgroupid;
		
			
			/// <summary>
		/// Property OperationList - gets or sets a list of Operation objects upon which this entity depends.</summary>
		/// <remarks> Used mostly to populate the select controls on the view side. Returns the list sorted by the default property, if one is defined.</remarks>
		/// <value> An ObjectList of  Operation. </value>
		public ObjectList<Operation> OperationList
		{
    		get 
    		{
					if (_operationList != null)
				{
					_operationList.Sort("Name", SortDirection.Ascending);
				}
					return _operationList;  
    		}
    		set {_operationList = value;}
		}

		private ObjectList<Operation> _operationList;
			
			/// <summary>
		/// Property EntityTypeList - gets or sets a list of EntityType objects upon which this entity depends.</summary>
		/// <remarks> Used mostly to populate the select controls on the view side. Returns the list sorted by the default property, if one is defined.</remarks>
		/// <value> An ObjectList of  EntityType. </value>
		public ObjectList<EntityType> EntityTypeList
		{
    		get 
    		{
					if (_entitytypeList != null)
				{
					_entitytypeList.Sort("Name", SortDirection.Ascending);
				}
					return _entitytypeList;  
    		}
    		set {_entitytypeList = value;}
		}

		private ObjectList<EntityType> _entitytypeList;
			
			/// <summary>
		/// Property EntitiesGroupList - gets or sets a list of EntitiesGroup objects upon which this entity depends.</summary>
		/// <remarks> Used mostly to populate the select controls on the view side. Returns the list sorted by the default property, if one is defined.</remarks>
		/// <value> An ObjectList of  EntitiesGroup. </value>
		public ObjectList<EntitiesGroup> EntitiesGroupList
		{
    		get 
    		{
					if (_entitiesgroupList != null)
				{
					_entitiesgroupList.Sort("Name", SortDirection.Ascending);
				}
					return _entitiesgroupList;  
    		}
    		set {_entitiesgroupList = value;}
		}

		private ObjectList<EntitiesGroup> _entitiesgroupList;
			
			/// <summary>
		/// Property UsersGroupList - gets or sets a list of UsersGroup objects upon which this entity depends.</summary>
		/// <remarks> Used mostly to populate the select controls on the view side. Returns the list sorted by the default property, if one is defined.</remarks>
		/// <value> An ObjectList of  UsersGroup. </value>
		public ObjectList<UsersGroup> UsersGroupList
		{
    		get 
    		{
					if (_usersgroupList != null)
				{
					_usersgroupList.Sort("Name", SortDirection.Ascending);
				}
					return _usersgroupList;  
    		}
    		set {_usersgroupList = value;}
		}

		private ObjectList<UsersGroup> _usersgroupList;
			
			/// <summary>
		/// Property UserList - gets or sets a list of AuthenticatedUser objects upon which this entity depends.</summary>
		/// <remarks> Used mostly to populate the select controls on the view side. Returns the list sorted by the default property, if one is defined.</remarks>
		/// <value> An ObjectList of  AuthenticatedUser. </value>
		public ObjectList<AuthenticatedUser> UserList
		{
    		get 
    		{
					if (_userList != null)
				{
					_userList.Sort("Login", SortDirection.Ascending);
				}
					return _userList;  
    		}
    		set {_userList = value;}
		}

		private ObjectList<AuthenticatedUser> _userList;
			
	
		/// <summary>
		/// Binds the surrogate values to the search template.
		/// </summary>
		/// <param name="emptyTemplate">The empty template.</param>
		public void BindToSearchTemplate(PermissionTemplate emptyTemplate)
		{
	
																			if (this.OperationID != null)
				emptyTemplate.OperationID = this.OperationID.Value;
											
																	if (this.EntityTypeID != null)
				emptyTemplate.EntityTypeID = this.EntityTypeID.Value;
													
																									if (this.EntitiesGroupID != null)
				emptyTemplate.EntitiesGroupID = this.EntitiesGroupID.Value;
					
																							if (this.UsersGroupID != null)
				emptyTemplate.UsersGroupID = this.UsersGroupID.Value;
							
																					if (this.UserID != null)
				emptyTemplate.UserID = this.UserID.Value;
											}

	}
	#endregion

}

